package com.aw.puzzle.dropboxdiet;

import com.aw.puzzle.dropboxdiet.support.ActivityCollector;

import java.util.Date;
import java.util.List;

/**
 * User: gmc
 * Date: 29/01/11
 */
public class Dietist {
    private ActivityCollector activityCollector;
    private Algorithm algorithm = new Algorithm();

    public void generateActivityGroupsThatSumZeroCalories() {
        long init = new Date().getTime();
        algorithm.setAllActivities(activityCollector.getAllActivities());
        List<ActivityGroup> activityGroups = algorithm.getActivityGroupsThatSumZeroCalories();
        long end = new Date().getTime();
        System.out.println("Execution Time:" + (end - init));
        if (activityGroups.size() == 0) {
            System.out.println("no solution");
        } else {
            System.out.println("Groups of activities that sum zero:" + activityGroups.size());
            for (ActivityGroup activityGroup : activityGroups) {
                System.out.println(activityGroup.getStrOfActivitiesSorted());
            }
        }
    }

    public ActivityCollector getActivityCollector() {
        return activityCollector;
    }

    public void setActivityCollector(ActivityCollector activityCollector) {
        this.activityCollector = activityCollector;
    }
}
